package net.zretc.service.impl;

import net.zretc.entity.Product;
import net.zretc.mapper.ProductMapper;
import net.zretc.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductMapper productMapper;

    @Override
    public List<Product> findAll() {
        return productMapper.selectList(null);
    }

    @Override
    public int insert(Product product) {
        return productMapper.insert(product);
    }

    @Override
    public int update(Product product) {
        return productMapper.updateById(product);
    }

    @Override
    public int delete(Integer productId) {
        return productMapper.deleteById(productId);
    }
}
